Current Location: Home> Function Categories> srand

srand

Sow the random number generator seeds
Name:srand
Category:math
Programming Language:php
One-line Description:Sow the random number generator seeds.

Definition and usage

srand() function sows the random number generator seed.

Example

In this example, we will seed the random number generator:

 <?php
srand ( mktime ( ) ) ;
echo ( rand ( ) ) ;
?>

Try it yourself

grammar

 srand ( seed )
parameter describe
seed Optional. Use seed to sow the random number generator seeds.

illustrate

Starting from PHP version 4.2.0, the seed parameter becomes optional, and when this item is empty, it will be set to any time.

Similar Functions
  • Sow a better random number generator seed mt_srand

    mt_srand

    Sowabetterrandomnumb
  • Show the maximum possible value of random number getrandmax

    getrandmax

    Showthemaximumpossib
  • Antihyperbolic cosine acosh

    acosh

    Antihyperboliccosine
  • Natural logarithm log

    log

    Naturallogarithm
  • Determine whether it is a legal value is_nan

    is_nan

    Determinewhetheritis
  • Convert decimal to hexadecimal dechex

    dechex

    Convertdecimaltohexa
  • Calculate the index of e exp

    exp

    Calculatetheindexofe
  • Convert hexadecimal to decimal hexdec

    hexdec

    Converthexadecimalto
Popular Articles